local skel = fk.CreateSkill {
  name = "emo__huding",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["emo__huding"] = "虎定",
  [":emo__huding"] = "结束阶段，你可以对装备区牌数等于你的角色各造成一点伤害。",

  ["#emo__huding-ask"] = "虎定：你可以对装备区牌数等于你的角色各造成一点伤害",

  ["$emo__huding1"] = "",
  ["$emo__huding2"] = "",
}

skel:addEffect(fk.EventPhaseStart, {
  anim_type = "offensive",
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and player.phase == Player.Finish
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local tos = table.filter(room:getAlivePlayers(), function (p)
      return #p:getCardIds("e") == #player:getCardIds("e")
    end)
    if #tos == 0 then return false end
    if room:askToSkillInvoke(player, {skill_name = skel.name, prompt = "#emo__huding-ask" }) then
      event:setCostData(self, {tos = tos})
      return true
    end
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    for _, to in ipairs(event:getCostData(self).tos) do
      if not to.dead then
        room:damage { from = player, to = to, damage = 1, skillName = skel.name }
      end
    end
  end,
})

return skel
